return {
	{
		"ojroques/nvim-osc52",
		config = function()
			-- 设置默认剪贴板行为
			vim.opt.clipboard = "unnamedplus"

			local osc52 = require("osc52")
			osc52.setup({ max_length = 0, silent = true, trim = false })

			-- 智能剪贴板后端选择
			local function setup_clipboard()
				-- 1. 优先使用 OSC52 + tmux 组合（如果在 tmux 中）
				if vim.env.TMUX then
					return {
						name = "osc52+tmux",
						copy = {
							["+"] = function(text)
								-- 确保 text 是字符串
								if type(text) == "table" then
									text = table.concat(text, "\n")
								end
								osc52.copy(text)
								vim.fn.system("tmux load-buffer -w -", text)
							end,
							["*"] = function(text)
								if type(text) == "table" then
									text = table.concat(text, "\n")
								end
								osc52.copy(text)
								vim.fn.system("tmux load-buffer -w -", text)
							end,
						},
						paste = {
							["+"] = function()
								local osc_text = osc52.paste()
								if osc_text and #osc_text > 0 then
									return osc_text
								end
								return vim.fn.system("tmux save-buffer -")
							end,
							["*"] = function()
								local osc_text = osc52.paste()
								if osc_text and #osc_text > 0 then
									return osc_text
								end
								return vim.fn.system("tmux save-buffer -")
							end,
						},
					}
				end

				-- 2. 纯 OSC52 方案
				return {
					name = "osc52",
					copy = {
						["+"] = function(text)
							if type(text) == "table" then
								text = table.concat(text, "\n")
							end
							osc52.copy(text)
						end,
						["*"] = function(text)
							if type(text) == "table" then
								text = table.concat(text, "\n")
							end
							osc52.copy(text)
						end,
					},
					paste = {
						["+"] = osc52.paste,
						["*"] = osc52.paste,
					},
				}
			end

			-- 应用配置
			vim.g.clipboard = setup_clipboard()

			-- 添加调试命令
			vim.api.nvim_create_user_command("ClipboardInfo", function()
				print("当前剪贴板后端: " .. vim.g.clipboard.name)
				print("终端: WezTerm")
				print("TMUX 会话: " .. (vim.env.TMUX and "是" or "否"))
			end, {})
		end,
		init = function()
			-- 确保即使插件未加载也能有基本功能
			vim.opt.clipboard = "unnamedplus"

			-- 设置纯 tmux 回退
			if not package.loaded["osc52"] and vim.env.TMUX then
				vim.g.clipboard = {
					name = "tmux",
					copy = {
						["+"] = function(lines)
							if type(lines) == "table" then
								lines = table.concat(lines, "\n")
							end
							vim.fn.system("tmux load-buffer -w -", lines)
						end,
						["*"] = function(lines)
							if type(lines) == "table" then
								lines = table.concat(lines, "\n")
							end
							vim.fn.system("tmux load-buffer -w -", lines)
						end,
					},
					paste = {
						["+"] = function()
							return vim.fn.system("tmux save-buffer -")
						end,
						["*"] = function()
							return vim.fn.system("tmux save-buffer -")
						end,
					},
				}
			end
		end,
	},
}
